<template>
  <div class="containers">
    <div class="head">
      <!--顶部-->
      <div class="right">
        <div class="right-box">
          <div class="right-inner">
            <div class="user">
              <span class="user-icon"></span>
              <span class="user-info">{{name}}</span>
            </div>
            <a class="logout" href="javascript:void(0)" @click="logout"></a>
          </div>
        </div>
      </div>
    </div>
    <div class="box">
      <div class="content">
        <router-view>
          <!--内容主体-->
        </router-view>
        <div class="bottom">
          <span>测试</span>
        </div>
      </div>
      <div class="aside">
        <!--左侧菜单-->
        <ul class="menu-list">
          <li v-bind:class="current==='wechat'?'current':''"><a href="javascript:void(0)" data-router="wechat" @click="menu_select"><span class="model"></span>公众号</a></li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
  import {getCookie} from '@/config/util'

  export default {
    data(){
      return{
        current:"advertiser",
        name:"admin"
      }
    },
    created: function () {
      this.name = getCookie("username");
      let router = this.$router.currentRoute.path.split('/');
      this.current = router.length > 1 ? router[1] : this.current;
    },
    methods:{
      logout(){
        this.$router.push({
          path:'/'
        });
      },
      menu_select(e){
        this.current=e.target.getAttribute("data-router");
        this.$router.push({
          path:'/'+this.current
        });
      }
    }
  }
</script>

<style scoped>
  @import "../assets/css/pages/main.css";
</style>
